package config

import (
	"common/helper"
	"database/sql"
)

type CfgSuspensionImages struct {
	Id            int    `json:"id" db:"id"`
	Images        string `json:"images" db:"images"`                 //图片链接
	JumpType      int    `json:"jump_type" db:"jump_type"`           //1内链接，2外链接
	Sort          int    `json:"sort" db:"sort"`                     //排序
	Status        int    `json:"status" db:"status"`                 //状态 0 关闭  1开启
	DisplayMethod int    `json:"display_method" db:"display_method"` //显示方式 1=独立 2=合并
	Url           string `json:"url" db:"url"`                       //跳转链接
	PcImages      string `json:"pc_images" db:"pc_images"`           //pc端图片
	Length        string `json:"length" db:"length"`                 //长
	Width         string `json:"width" db:"width"`                   //宽
	Title         string `json:"title" db:"title"`                   //标题
}

var G_cfgSuspensionImagesList []CfgSuspensionImages

func GetCfgSuspensionImages() []CfgSuspensionImages {
	return G_cfgSuspensionImagesList
}

func SuspensionImagesSetRow(rows *sql.Rows) {
	var tVal CfgSuspensionImages
	var err error
	err = rows.Scan(&tVal.Id, &tVal.Images, &tVal.JumpType, &tVal.Sort, &tVal.Status, &tVal.DisplayMethod, &tVal.Url, &tVal.PcImages, &tVal.Length, &tVal.Width, &tVal.Title)

	if err != nil {
		helper.InfoLog("SuspensionImagesSetRow scan err")
		return
	}
	G_cfgSuspensionImagesList = append(G_cfgSuspensionImagesList, tVal)
}

func SuspensionImagesRemove() {
	G_cfgSuspensionImagesList = []CfgSuspensionImages{}
}
